//
//  WHForwordCell.swift
//  8.31-WH微博
//
//  Created by 吴涵 on 15/9/12.
//  Copyright © 2015年 wuhan. All rights reserved.
//

import UIKit

class WHForwordCell: WHStatusViewCell {

    override var statusViewModel: WHUserStatusModel? {
        didSet{
        forwardLabel.text = statusViewModel?.forwardText
        }
    }
    
    override func setUpUI() {
        super.setUpUI()
        
        contentView.insertSubview(backGroudBtn, belowSubview: pictureView)
        
        contentView.insertSubview(forwardLabel, aboveSubview: backGroudBtn)
        
        backGroudBtn.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: contentLabel, size: nil, offset: CGPoint(x: -WHStatusCellMargin, y: WHStatusCellMargin))
        backGroudBtn.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bottomView, size: nil)
        
        forwardLabel.ff_AlignInner(type: ff_AlignType.TopLeft, referView: backGroudBtn, size: nil, offset: CGPoint(x: WHStatusCellMargin, y: WHStatusCellMargin))
        
                let cons = pictureView.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: forwardLabel, size: CGSize(width: WHStatusPictureMaxWidth, height: WHStatusPictureMaxWidth), offset: CGPoint(x: 0, y: WHStatusCellMargin))
                /// 记录配图的视图约束
                pictureViewWidthCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Width)
                pictrueViewHeightCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Height)
                pictureViewTopCons = pictureView.ff_Constraint(cons, attribute: NSLayoutAttribute.Top)
        
    }
    
    private lazy var  backGroudBtn: UIButton =  {
       let btn = UIButton()
        btn.backgroundColor = UIColor(white: 0.9, alpha: 1.0)
        return btn
    }()
    
    private lazy var forwardLabel: UILabel = UILabel(title: "转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博转发微博", color: UIColor.darkGrayColor(), fontSize: 14, layoutWidth: UIScreen.mainScreen().bounds.width - 2 * WHStatusCellMargin)

}
